package com.java.zhuiyun.api.video_manage.mapper;

import com.java.zhuiyun.api.file_manager.entity.FileManager;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface VideoManageMapper {
    /**
    * @Author MJL
    * @Description todo 查询所有尚未审核文件
    * @Date 2023/8/21 19:54
    * @Return  * @param null
    */
    @Select("SELECT f.* , u.nick_name , u.id user_id FROM file_manager f \n" +
            "INNER JOIN sys_user u ON f.uploaded_by = u.id \n" +
            "WHERE f.del_flag = 0 AND f.audit_type = 0")
    List<FileManager> queryVideoManage(FileManager fileManager);

    /**
    * @Author MJL
    * @Description todo 将尚未审核的文件进行审核通过
    * @Date 2023/8/22 10:53
    * @Return  * @param null
    */
    @Update("update file_manager set audit_type = 1 " +
            "where file_manager_id = #{fileManagerId} and audit_type = 0")
    int auditSucced(FileManager fileManager);

    /**
    * @Author MJL
    * @Description todo 将尚未审核的视频进行审核失败
    * @Date 2023/8/22 11:25
    * @Return  * @param null
    */
    @Update("update file_manager set audit_type = 2 " +
            "where file_manager_id = #{fileManagerId} and audit_type = 0")
    int auditFail(FileManager fileManager);

    @Select("select * from file_manager where file_manager_id = #{fileManagerId} and audit_type = 0")
    Integer Preview(Integer fileManagerId);
}
